﻿@model IEnumerable<MvcApplication.Models.NhanSuModel>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>        
        <th>
            
        </th>
        <th>
            Họ tên
        </th>
        <th>
            Giới tính
        </th>
        <th>
            Ngày sinh
        </th>
        <th>
            Đ/C
        </th>
        <th>
            SĐT
        </th>
        <th>
            Email
        </th>
        <th>
            Chức vụ
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @if (item.hinh_anh == null)
            {
                <b>No image</b>            
            }
            else
            {
                <img src="@Url.Action("IdToPhoto", new { id = item.id_nhan_su })"
                     alt="@item.ho_ten" width="100" height="100"/>
            }
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ho_ten)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.gioi_tinh)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.ngay_sinh)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.dia_chi)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.so_dien_thoai)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.email)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.chuc_vu)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id = item.id_nhan_su }) |
            @Html.ActionLink("Details", "Details", new { id = item.id_nhan_su }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.id_nhan_su })
        </td>
    </tr>
}

</table>
